﻿#pragma once
#include "CMyEdit.h"


// CAddrRes 对话框

class CAddrRes : public CDialogEx
{
	DECLARE_DYNAMIC(CAddrRes)

public:
	CAddrRes(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CAddrRes();

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_DIALOG2 };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()

private:

	char **m_pFileData = NULL;
	DWORD* m_pFileSize = 0;

public:

	void SetFileDataAddr(char **pAddr);

	void SetFileDataSize(DWORD* pFileSize);

private:

	//根据偏移值和对齐值计算对齐后的大小
	DWORD CalcOffset(DWORD dwVal, DWORD dwAlign);

	//用户通过VA算出RVA和FOA
	void VA_TO_RVA_AND_FOA();

	//用户通过RVA算出VA和FOA
	void RVA_TO_VA_AND_FOA();

	//用户通过FOA算出VA和RVA
	void FOA_TO_VA_AND_RVA();

public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	CMyEdit m_EditVA;
	CMyEdit m_EditRVA;
	CMyEdit m_EditFOA;
};
